

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>创建 Ceph 文件系统 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="CephFS 管理命令" href="../administration/" />
    <link rel="prev" title="Ceph 文件系统" href="../" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">Ceph 文件系统</a> &raquo;</li>
        
      <li>创建 Ceph 文件系统</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/cephfs/createfs.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id4">管理</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#"> 创建 CephFS 文件系统</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">创建存储池</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">创建文件系统</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">在 CephFS 中使用纠删码存储池</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../administration/"> 管理命令</a></li>
<li class="toctree-l3"><a class="reference internal" href="../multifs/"> 创建多个文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-remove-mds/"> 配备、增加、删除 MDS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/">术语</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds">MDS 守护进程的引用</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#id3">故障切换的管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-standby-replay">热备的配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-join-fs">配置 MDS 与文件系统的亲和性</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-configuration/"> MDS 缓存配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds-config-ref/"> MDS 配置选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/ceph-mds/"> ceph-mds 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nfs/"> 通过 NFS 导出</a></li>
<li class="toctree-l3"><a class="reference internal" href="../app-best-practices/"> 应用最佳实践</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fs-volumes/"> FS 卷和子卷</a></li>
<li class="toctree-l3"><a class="reference internal" href="../quota/"> CephFS 配额管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-messages/"> 健康消息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/">升级 MDS 集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/#firefly-jewel">升级比 Firefly 老的文件系统，需过 Jewel 这个槛</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-top/"> CephFS Top 工具</a></li>
<li class="toctree-l3"><a class="reference internal" href="../snap-schedule/"> 定时快照</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-mirroring/"> CephFS 快照镜像</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="ceph">
<h1>创建 Ceph 文件系统<a class="headerlink" href="#ceph" title="Permalink to this headline">¶</a></h1>
<div class="section" id="id1">
<h2>创建存储池<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<p>一个 Ceph 文件系统需要至少两个 RADOS 存储池，一个用于数据、一个用于元数据。配置这些存储池时需考虑：</p>
<ul class="simple">
<li><p>为元数据存储池设置更高的副本级别，因为此存储池丢失任何数据都会导致整个文件系统失效。</p></li>
<li><p>为元数据存储池分配延时较低的存储器（像 SSD ），因为它会直接影响到客户端的操作延时。</p></li>
<li><p>用于创建文件系统的数据存储池是“默认”存储池，它还存储着所有的索引节点回溯信息，
可用于管理硬链接和灾难恢复。正因为如此， CephFS 内创建的所有索引节点都至少有一个对象存储于默认的数据存储池。如果文件系统打算采用纠删码存储池，
一般来说，最好用副本存储池作为默认的数据存储池，以提升更新回溯信息时涉及的小对象读写性能。另外，可以单独加一个纠删码存储池（参见 <a class="reference internal" href="../../rados/operations/erasure-code/#ecpool"><span class="std std-ref">纠删码</span></a> ）
用于存储整个子树下的目录和文件（参见 <a class="reference internal" href="../file-layouts/#file-layouts"><span class="std std-ref">文件布局</span></a> ）。</p></li>
</ul>
<p>关于存储池的管理请参考 <a class="reference internal" href="../../rados/operations/pools/"><span class="doc">存储池</span></a> 。例如，要用默认设置为文件系统创建两个存储池，你可以用下列命令：</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ ceph osd pool create cephfs_data
$ ceph osd pool create cephfs_metadata
</pre></div>
</div>
<p>通常，元数据存储池最多也就有几个 GB 的数据，因此我们建议用较小的 PG 数，在用的大型集群通常用 64 或 128 个。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>文件系统、元数据存储池、和数据存储池的名字只能用
[a-zA-Z0-9_-.] 里的字符。</p>
</div>
</div>
<div class="section" id="id2">
<h2>创建文件系统<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>创建好存储池后，你就可以用 <code class="docutils literal notranslate"><span class="pre">fs</span> <span class="pre">new</span></code> 命令启用文件系统了：</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ ceph fs new &lt;fs_name&gt; &lt;metadata&gt; &lt;data&gt;
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ ceph fs new cephfs cephfs_metadata cephfs_data
$ ceph fs ls
name: cephfs, metadata pool: cephfs_metadata, data pools: <span class="o">[</span>cephfs_data <span class="o">]</span>
</pre></div>
</div>
<p>文件系统创建完毕后， MDS 服务器就能达到 <em>active</em> 状态了，比如在一个单 MDS 系统中：</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ ceph mds stat
cephfs-1/1/1 up <span class="o">{</span><span class="nv">0</span><span class="o">=</span><span class="nv">a</span><span class="o">=</span>up:active<span class="o">}</span>
</pre></div>
</div>
<p>建好文件系统且 MDS 活跃后，你就可以挂载此文件系统了。如果你创建的文件系统不止一个，挂载的时候还需指定挂载哪个。</p>
<blockquote>
<div><ul class="simple">
<li><p><a class="reference external" href="../../cephfs/mount-using-kernel-driver">挂载 CephFS 文件系统</a></p></li>
<li><p><a class="reference external" href="../../cephfs/mount-using-fuse">把 CephFS 挂载为用户空间文件系统</a></p></li>
<li><p><a class="reference external" href="../../cephfs/ceph-dokan">在 Windows 上挂载 CephFS</a></p></li>
</ul>
</div></blockquote>
<p>如果你创建了不止一个文件系统，而且客户端在挂载时还不指定哪个文件系统，
这时你可以用 <cite>ceph fs set-default</cite> 命令来决定他们能看到的文件系统。</p>
<div class="section" id="id4">
<h3>向文件系统增加数据存储池<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>见 <a class="reference internal" href="../file-layouts/#adding-data-pool-to-file-system"><span class="std std-ref">把数据存储池加入文件系统</span></a> 。</p>
</div>
</div>
<div class="section" id="id5">
<h2>在 CephFS 中使用纠删码存储池<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h2>
<p>纠删码存储池在启用覆写功能后可以用作 CephFS 的数据存储池，这样启用：</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>ceph osd pool <span class="nb">set</span> my_ec_pool allow_ec_overwrites <span class="nb">true</span>
</pre></div>
</div>
<p>注意， EC 的覆写功能只有在 OSD 们都使用 BlueStore 后端时才支持。</p>
<p>纠删码存储池不能用作 CephFS 的元数据存储池，因为 CephFS 元数据是用 RADOS <em>OMAP</em> 数据结构存储的，而 EC 存储池不能存储。</p>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../administration/" class="btn btn-neutral float-right" title="CephFS 管理命令" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../" class="btn btn-neutral float-left" title="Ceph 文件系统" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>